#include("/manage/_common/_layout.html")
#@layout()

### ********************************* 定义页面标题
#define title()
修改密码
#end

### ********************************* css导入
#define import_css()
#end

### ********************************* js导入
#define import_js()
<script src="#(ctx)/manage/_assets/js/form.js" type="text/javascript"></script>
#end

### ********************************* Body内容区开始
#define main()
<div class="layui-row layui-col-space15">
	<div class="layui-card">
		<div class="layui-card-header">修改密码</div>
		<div class="layui-card-body" pad15="">
			<form class="layui-form" action="#(ctx)/manage/admin/changePassword" method="post">
				<div class="layui-form-item">
					<label class="layui-form-label layui-bg-blue">当前密码</label>
					<div class="layui-input-inline">
						<input type="password" name="oldPassword" lay-verify="required|oldPassword"
							   class="layui-input" autocomplete="off" value="#(oldPassword)">
					</div>
					<div class="layui-form-mid layui-word-aux">旧密码</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label layui-bg-blue">新密码</label>
					<div class="layui-input-inline">
						<input type="password" name="newPassword" lay-verify="required|newPassword"
							   autocomplete="off" id="ID_new_password"
							   class="layui-input" value="#(newPassword)">
					</div>
					<div class="layui-form-mid layui-word-aux">6到20个字符</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label layui-bg-blue">确认密码</label>
					<div class="layui-input-inline">
						<input type="password" name="confirmPassword" lay-verify="required|confirmPassword"
							   autocomplete="off" class="layui-input" value="#(confirmPassword)">
					</div>
					<div class="layui-form-mid layui-word-aux">与新密码相同</div>
				</div>
				<div class="layui-form-item">
					<div class="layui-input-block">
						<button class="layui-btn" lay-submit="">确认修改</button>
						<button type="reset" class="layui-btn layui-btn-primary">重新填写</button>
					</div>
				</div>
			</form>
		</div>
	</div>
</div>
#end
### ********************************* Body内容区结束


### ********************************* 脚本区开始
#define script()
<script>
layui.use(['jquery', 'layer', 'element', 'form'], function(){
	var $ = layui.jquery, layer = layui.layer,element = layui.element, form = layui.form;

	#if(flashMsg)
	layer.msg("#(flashMsg)");
	#end

	### 自定义验证规则
	form.verify({
		oldPassword : function(value, item) {
			if (value.length < 6 || value.length > 20) {
				return '当前密码必须6到20位字符';
			}
		},
		newPassword : function(value, item){
			if (value.length < 6 || value.length > 20) {
				return '新密码必须6到20位字符';
			}
		},
		confirmPassword : function(value, item){
			if (value != $("#ID_new_password").val()) {
				return '确认密码必须和新密码相同';
			}
		}
	});
});
</script>
#end
### ********************************* JS脚本区结束